home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 October / EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso / Aminet / mus / misc / P6102.lha / Player6.1A / Source / 610.2.G < prev    next >
Text File  |  1995-06-22  |  41KB  |  2,653 lines

  1. * The Player 6.1A for Asm-One 1.09 and later *
  2.  
  3. ;start = 6    ;Starting position
  4.  
  5. fade  = 1    ;0 = Normal, NO master volume control possible
  6.         ;1 = Use master volume (P61_Master)
  7.  
  8. jump = 1    ;0 = do NOT include position jump code (P61_SetPosition)
  9.         ;1 = Include
  10.  
  11. system = 1    ;0 = killer
  12.         ;1 = friendly
  13.  
  14. CIA = 1        ;0 = CIA disabled
  15.         ;1 = CIA enabled
  16.  
  17. exec = 1    ;0 = ExecBase destroyed
  18.         ;1 = ExecBase valid
  19.  
  20. lev6 = 1    ;0 = NonLev6
  21.         ;1 = Lev6 used
  22.  
  23. opt020 = 0    ;0 = MC680x0 code
  24.         ;1 = MC68020+ or better
  25.  
  26. channels = 4    ;amount of channels to be played
  27.  
  28. use = -1    ;The Usecode
  29.  
  30.     incdir    include:
  31.     include Player61.i
  32.  
  33. *-----------------------------------------------*
  34.  
  35.     printt    ""
  36.     printt    "Options used:"
  37.     printt    "-------------"
  38.     ifd    start
  39.     printt    "Starting from position"
  40.     printv    start
  41.     endc
  42.     ifne    fade
  43.     printt    "Mastervolume on"
  44.     else
  45.     printt    "Mastervolume off"
  46.     endc
  47.     ifne    system
  48.     printt    "System friendly"
  49.     else
  50.     printt    "System killer"
  51.     endc
  52.     ifne    CIA
  53.     printt    "CIA-tempo on"
  54.     else
  55.     printt    "CIA-tempo off"
  56.     endc
  57.     ifne    exec
  58.     printt    "ExecBase valid"
  59.     else
  60.     printt    "ExecBase invalid"
  61.     endc
  62.     ifne    lev6
  63.     printt    "Level 6 IRQ on"
  64.     else
  65.     printt    "Non-lev6 NOT IMPLEMENTED!"
  66.     if2
  67.     fail
  68.     endc
  69.     endc
  70.     ifne    opt020
  71.     printt    "MC68020 optimizations"
  72.     else
  73.     printt    "Normal MC68000 code"
  74.     endc
  75.     printt    "Channels:"
  76.     printv    channels
  77.     ifgt    channels-4
  78.     printt    "NO MORE THAN 4 CHANNELS!"
  79.     if2
  80.     fail
  81.     endc
  82.     endc
  83.     ifeq    channels
  84.     printt    "MUST HAVE AT LEAST 1 CHANNEL!"
  85.     if2
  86.     fail
  87.     endc
  88.     endc
  89.     printt    "UseCode:"
  90.     printv    use
  91.  
  92. *-----------------------------------------------*
  93.  
  94.  
  95.     section    Player6.1A,code
  96.  
  97.     movem.l    d0-a6,-(sp)
  98.     lea    $dff000,a6
  99.     ifeq    system
  100.     move    $1c(a6),-(sp)
  101.     move    #$7fff,$9a(a6)
  102.     move    2(a6),-(sp)
  103.     move    #$7ff,$96(a6)
  104.     endc
  105.  
  106.     lea    P61_data,a0    ;Module
  107.     sub.l    a1,a1        ;No separate samples
  108. ;    lea    P61_smp,a1    ;Samples
  109.  
  110.     lea    samples,a2    ;Sample buffer
  111.     moveq    #0,d0        ;Auto Detect
  112.     bsr    P61_motuuli+P61_InitOffset
  113.  
  114.     tst    d0        ;Went ok?
  115.     bne    P61_exit
  116.  
  117. P61_sync
  118.     ifeq    CIA
  119.     move.l    4(a6),d0
  120.     andi.l    #$1ff00,d0
  121.     cmp.l    #$8100,d0
  122.     bne.b    P61_sync
  123.  
  124. P61_sync2
  125.     move.l    4(a6),d0
  126.     andi.l    #$1ff00,d0
  127.     cmp.l    #$8200,d0
  128.     bne.b    P61_sync2
  129.  
  130.     move    #$fff,$180(a6)
  131.     bsr    P61_motuuli+P61_MusicOffset
  132.     clr    $180(a6)
  133.  
  134.     moveq    #0,d0
  135.     move    6(a6),d0
  136.     sub.l    #$8200,d0
  137.     cmp.l    P61_raster(pc),d0
  138.     ble.b    P61_kosj
  139.     move    d0,P61_raster+2
  140. P61_kosj
  141.     tst    P61_raster2+2
  142.     bne.b    P61_doing
  143.     move    d0,P61_raster2+2
  144.     bra.b    P61_doneg
  145. P61_doing
  146.     add.l    P61_raster2(pc),d0
  147.     asr.l    #1,d0
  148.     move.l    d0,P61_raster2
  149. P61_doneg
  150.     addq.l    #1,P61_frames
  151.  
  152.     ifne    fade
  153.     btst    #10,$16(a6)
  154.     bne.b    P61_jid
  155.     move    P61_diri(pc),d0
  156.     sub    d0,P61_motuuli+P61_MasterVolume
  157.     bne.b    P61_judo
  158.     neg    P61_diri
  159.     bra.b    P61_jid
  160. P61_judo
  161.     cmp    #64,P61_motuuli+P61_MasterVolume
  162.     bne.b    P61_jid
  163.     neg    P61_diri
  164.     endc
  165.  
  166. P61_jid
  167.     endc
  168.  
  169.     btst    #6,$bfe001
  170.     bne    P61_sync
  171.  
  172. P61_exit
  173.     bsr    P61_motuuli+P61_EndOffset
  174.  
  175.     ifeq    system
  176.     move    (sp)+,d7
  177.     bset    #15,d7
  178.     move    #$7ff,$96(a6)
  179.     move    d7,$96(a6)
  180.  
  181.     move    (sp)+,d7
  182.     bset    #15,d7
  183.     move    #$7fff,$9a(a6)
  184.     move    d7,$9a(a6)
  185.     endc
  186.     movem.l    (sp)+,d0-a6
  187.  
  188.     move.l    P61_raster(pc),d0
  189.     move.l    P61_raster2(pc),d1
  190.     move.l    P61_frames(pc),d2
  191.     move.l    P61_positionbase(pc),a0
  192.     move.l    P61_patternbase(pc),a1
  193.     move.l    P61_spos(pc),a2
  194.     rts
  195.  
  196. P61_IRQsave    dc    0
  197. P61_DMAsave    dc    0
  198. P61_raster    dc.l    0
  199. P61_raster2    dc.l    0
  200. P61_frames    dc.l    0
  201. P61_diri    dc    1
  202.  
  203. *********************************
  204. *        Player 6.1A ®        *
  205. *      All in one-version    *
  206. *        Version 610.2        *
  207. *   © 1992-95 Jarno Paananen    *
  208. *     All rights reserved    *
  209. *********************************
  210.  
  211.  
  212. ******** START OF BINARY FILE **************
  213.  
  214. P61_motuuli
  215.     bra.w    P61_Init
  216.     ifeq    CIA
  217.     bra.w    P61_Music
  218.     else
  219.     rts
  220.     rts
  221.     endc
  222.     bra.w    P61_End
  223.     rts                ;no P61_SetRepeat
  224.     rts
  225.     bra.w    P61_SetPosition
  226.  
  227. P61_Master    dc    64        ;Master volume (0-64)
  228. P61_Tempo    dc    1        ;Use tempo? 0=no,non-zero=yes
  229. P61_Play    dc    1        ;Stop flag (0=stop)
  230. P61_E8        dc    0        ;Info nybble after command E8
  231. P61_VBR        dc.l    0        ;If you're using non-valid execbase
  232.                     ;put VBR here! (Otherwise 0 assumed)
  233.                     ;You can also get VBR from here, if
  234.                     ;using exec-valid version
  235.  
  236. P61_Pos        dc    0        ;Current song position
  237. P61_Patt    dc    0        ;Current pattern
  238. P61_CRow    dc    0        ;Current pattern row
  239.  
  240. P61_Temp0Offset
  241.     dc.l    P61_temp0-P61_motuuli
  242. P61_Temp1Offset
  243.     dc.l    P61_temp1-P61_motuuli
  244. P61_Temp2Offset
  245.     dc.l    P61_temp2-P61_motuuli
  246. P61_Temp3Offset
  247.     dc.l    P61_temp3-P61_motuuli
  248.  
  249. P61_getnote    macro
  250.     moveq    #$7e,d0
  251.     and.b    (a5),d0
  252.     beq.b    .nonote
  253.     ifne    P61_vib
  254.     clr.b    P61_VibPos(a5)
  255.     endc
  256.     ifne    P61_tre
  257.     clr.b    P61_TrePos(a5)
  258.     endc
  259.  
  260.     ifne    P61_ft
  261.     add    P61_Fine(a5),d0
  262.     endc
  263.     move    d0,P61_Note(a5)
  264.     move    (a2,d0),P61_Period(a5)
  265.  
  266. .nonote
  267.     endm
  268.  
  269.     ifeq    system
  270.     ifne    CIA
  271. P61_intti
  272.     movem.l    d0-a6,-(sp)
  273.     tst.b    $bfdd00
  274.     lea    $dff000,a6
  275.     move    #$2000,$9c(a6)
  276.     move    #$fff,$180(a6)
  277.     bsr    P61_Music
  278.     move    #0,$180(a6)
  279.     movem.l    (sp)+,d0-a6
  280.     nop
  281.     rte
  282.     endc
  283.     endc
  284.  
  285.     ifne    system
  286. P61_lev6server
  287.     movem.l    d2-d7/a2-a6,-(sp)
  288.     lea    P61_timeron(pc),a0
  289.     tst    (a0)
  290.     beq.b    P61_ohi
  291.  
  292.     lea    $dff000,a6
  293.     move    P61_server(pc),d0
  294.     beq.b    P61_musica
  295.     subq    #1,d0
  296.     beq    P61_dmason
  297.     bra    P61_setrepeat
  298.  
  299. P61_musica
  300.     bsr    P61_Music
  301.  
  302. P61_ohi    movem.l    (sp)+,d2-d7/a2-a6
  303.     moveq    #1,d0
  304.     rts
  305.     endc
  306.  
  307. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  308. ;­ Call P61_Init to initialize the playroutine    ­
  309. ;­ D0 --> Timer detection (for CIA-version)    ­
  310. ;­ A0 --> Address to the module            ­
  311. ;­ A1 --> Address to samples/0 if in the module    ­
  312. ;­ A2 --> Address to sample buffer        ­
  313. ;­ D0 <-- 0 if succeeded            ­
  314. ;­ A6 <-- $DFF000                ­
  315. ;­         Uses D0-A6            ­
  316. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  317.  
  318. P61_Init
  319.     cmp.l    #"P61A",(a0)+
  320.     beq.b    .modok
  321.     subq.l    #4,a0
  322.  
  323. .modok    basereg    P61_cn,a3
  324.  
  325.     ifne    CIA
  326.     move    d0,-(sp)
  327.     endc
  328.  
  329.     moveq    #0,d0
  330.     cmp.l    d0,a1
  331.     bne.b    .redirect
  332.  
  333.     move    (a0),d0
  334.     lea    (a0,d0.l),a1
  335. .redirect
  336.     move.l    a2,a6
  337.     lea    8(a0),a2
  338.     moveq    #$40,d0
  339.     and.b    3(a0),d0
  340.     bne.b    .buffer
  341.     move.l    a1,a6
  342.     subq.l    #4,a2
  343. .buffer
  344.  
  345.     lea    P61_cn(pc),a3
  346.     moveq    #$1f,d1
  347.     and.b    3(a0),d1
  348.     move.l    a0,-(sp)
  349.     lea    P61_samples(pc),a4
  350.     subq    #1,d1
  351.     moveq    #0,d4
  352. P61_lopos
  353.     move.l    a6,(a4)+
  354.     move    (a2)+,d4
  355.     bpl.b    P61_kook
  356.     neg    d4
  357.     lea    P61_samples-16(pc),a5
  358.     ifeq    opt020
  359.     asl    #4,d4
  360.     move.l    (a5,d4),d6
  361.     else
  362.     add    d4,d4
  363.     move.l    (a5,d4*8),d6
  364.     endc
  365.     move.l    d6,-4(a4)
  366.     move    4(a5,d4),d4
  367.     sub.l    d4,a6
  368.     sub.l    d4,a6
  369.     bra.b    P61_jatk
  370.  
  371. P61_kook
  372.     move.l    a6,d6
  373.     tst.b    3(a0)
  374.     bpl.b    P61_jatk
  375.  
  376.     tst.b    (a2)
  377.     bmi.b    P61_jatk
  378.  
  379.     move    d4,d0
  380.     subq    #2,d0
  381.     bmi.b    P61_jatk
  382.  
  383.     move.l    a1,a5
  384.     move.b    (a5)+,d2
  385.     sub.b    (a5),d2
  386.     move.b    d2,(a5)+
  387. .loop    sub.b    (a5),d2
  388.     move.b    d2,(a5)+
  389.     sub.b    (a5),d2
  390.     move.b    d2,(a5)+
  391.     dbf    d0,.loop
  392.  
  393. P61_jatk
  394.     move    d4,(a4)+
  395.     moveq    #0,d2
  396.     move.b    (a2)+,d2
  397.     moveq    #0,d3
  398.     move.b    (a2)+,d3
  399.  
  400.     moveq    #0,d0
  401.     move    (a2)+,d0
  402.     bmi.b    .norepeat
  403.  
  404.     move    d4,d5
  405.     sub    d0,d5
  406.     move.l    d6,a5
  407.  
  408.     add.l    d0,a5
  409.     add.l    d0,a5
  410.  
  411.     move.l    a5,(a4)+
  412.     move    d5,(a4)+
  413.     bra.b    P61_gene
  414. .norepeat
  415.     move.l    d6,(a4)+
  416.     move    #1,(a4)+
  417. P61_gene
  418.     move    d3,(a4)+
  419.     moveq    #$f,d0
  420.     and    d2,d0
  421.     mulu    #74,d0
  422.     move    d0,(a4)+
  423.  
  424.     tst    -6(a2)
  425.     bmi.b    .nobuffer
  426.  
  427.     moveq    #$40,d0
  428.     and.b    3(a0),d0
  429.     beq.b    .nobuffer
  430.  
  431.     move    d4,d7
  432.     tst.b    d2
  433.     bpl.b    .copy
  434.  
  435.     subq    #1,d7
  436.     moveq    #0,d5
  437.     moveq    #0,d4
  438. .lo    move.b    (a1)+,d4
  439.     moveq    #$f,d3
  440.     and    d4,d3
  441.     lsr    #4,d4
  442.  
  443.     sub.b    .table(pc,d4),d5
  444.     move.b    d5,(a6)+
  445.     sub.b    .table(pc,d3),d5
  446.     move.b    d5,(a6)+
  447.     dbf    d7,.lo
  448.     bra.b    .kop
  449.  
  450. .copy    add    d7,d7
  451.     subq    #1,d7
  452. .cob    move.b    (a1)+,(a6)+
  453.     dbf    d7,.cob
  454.     bra.b    .kop
  455.  
  456. .table dc.b    0,1,2,4,8,16,32,64,128,-64,-32,-16,-8,-4,-2,-1
  457.  
  458. .nobuffer
  459.     move.l    d4,d6
  460.     add.l    d6,d6
  461.     add.l    d6,a6
  462.     add.l    d6,a1
  463. .kop    dbf    d1,P61_lopos
  464.  
  465.     move.l    (sp)+,a0
  466.     and.b    #$7f,3(a0)
  467.  
  468.     move.l    a2,-(sp)
  469.  
  470.     lea    P61_temp0(pc),a1
  471.     lea    P61_temp1(pc),a2
  472.     lea    P61_temp2(pc),a4
  473.     lea    P61_temp3(pc),a5
  474.     moveq    #Channel_Block_SIZE/2-2,d0
  475.  
  476.     moveq    #0,d1
  477. .cl    move    d1,(a1)+
  478.     move    d1,(a2)+
  479.     move    d1,(a4)+
  480.     move    d1,(a5)+
  481.     dbf    d0,.cl
  482.  
  483.     lea    P61_temp0(a3),a1
  484.     lea    P61_emptysample(a3),a2
  485.     moveq    #channels-1,d0
  486. .l    move.l    a2,P61_Sample(a2)
  487.     dbf    d0,.l
  488.  
  489.     move.l    (sp)+,a2
  490.     move.l    a2,P61_positionbase(a3)
  491.  
  492.     moveq    #$7f,d1
  493.     and.b    2(a0),d1
  494.  
  495.     ifeq    opt020
  496.     lsl    #3,d1
  497.     lea    (a2,d1.l),a4
  498.     else
  499.     lea    (a2,d1.l*8),a4
  500.     endc
  501.     move.l    a4,P61_possibase(a3)
  502.  
  503.     move.l    a4,a1
  504.     moveq    #-1,d0
  505. .search    cmp.b    (a1)+,d0
  506.     bne.b    .search
  507.     move.l    a1,P61_patternbase(a3)    
  508.     move.l    a1,d0
  509.     sub.l    a4,d0
  510.     move    d0,P61_slen(a3)
  511.  
  512.     ifd    start
  513.     lea    start(a4),a4
  514.     endc
  515.  
  516.     moveq    #0,d0
  517.     move.b    (a4)+,d0
  518.     move.l    a4,P61_spos(a3)
  519.     lsl    #3,d0
  520.     add.l    d0,a2
  521.  
  522.     move.l    a1,a4
  523.     moveq    #0,d0    
  524.     move    (a2)+,d0
  525.     lea    (a4,d0.l),a1
  526.     move.l    a1,P61_ChaPos+P61_temp0(a3)
  527.     move    (a2)+,d0
  528.     lea    (a4,d0.l),a1
  529.     move.l    a1,P61_ChaPos+P61_temp1(a3)
  530.     move    (a2)+,d0
  531.     lea    (a4,d0.l),a1
  532.     move.l    a1,P61_ChaPos+P61_temp2(a3)
  533.     move    (a2)+,d0
  534.     lea    (a4,d0.l),a1
  535.     move.l    a1,P61_ChaPos+P61_temp3(a3)
  536.  
  537.     lea    P61_setrepeat(pc),a0
  538.     move.l    a0,P61_intaddr(a3)
  539.  
  540.     move    #63,P61_rowpos(a3)
  541.     move    #6,P61_speed(a3)
  542.     move    #5,P61_speed2(a3)
  543.     clr    P61_speedis1(a3)
  544.  
  545.     ifne    P61_pl
  546.     clr.l    P61_plcount(a3)
  547.     endc
  548.  
  549.     ifne    P61_pde
  550.     clr    P61_pdelay(a3)
  551.     clr    P61_pdflag(a3)
  552.     endc
  553.     clr    (a3)
  554.  
  555.     moveq    #2,d0
  556.     and.b    $bfe001,d0
  557.     move.b    d0,P61_ofilter(a3)
  558.     bset    #1,$bfe001
  559.  
  560.     ifeq    system
  561.     ifne    exec
  562.     move.l    4.w,a6
  563.     moveq    #0,d0
  564.     btst    d0,297(a6)
  565.     beq.b    .no68010
  566.  
  567.     lea    P61_liko(pc),a5
  568.     jsr    -$1e(a6)
  569.  
  570. .no68010
  571.     move.l    d0,P61_VBR(a3)
  572.     endc
  573.  
  574.     move.l    P61_VBR(a3),a0
  575.     lea    $78(a0),a0
  576.     move.l    a0,P61_vektori(a3)
  577.  
  578.     move.l    (a0),P61_oldlev6(a3)
  579.     lea    P61_dmason(pc),a1
  580.     move.l    a1,(a0)
  581.     endc
  582.  
  583.     moveq    #0,d0
  584.     lea    $dff000,a6
  585.     move    d0,$a8(a6)
  586.     move    d0,$b8(a6)
  587.     move    d0,$c8(a6)
  588.     move    d0,$d8(a6)
  589.     move    #$f,$96(a6)
  590.  
  591.     ifeq    system
  592.     lea    P61_dmason(pc),a1
  593.     move.l    a1,(a0)
  594.     move    #$2000,$9a(a6)
  595.     lea    $bfd000,a0
  596.     lea    P61_timers(pc),a1
  597.     move.b    #$7f,$d00(a0)
  598.     move.b    #$10,$e00(a0)
  599.     move.b    #$10,$f00(a0)
  600.     move.b    $400(a0),(a1)+
  601.     move.b    $500(a0),(a1)+
  602.     move.b    $600(a0),(a1)+
  603.     move.b    $700(a0),(a1)
  604.     endc
  605.  
  606.     ifeq    system!CIA
  607.     move.b    #$82,$d00(a0)
  608.     endc
  609.  
  610.     ifne    CIA
  611.     move    (sp)+,d0
  612.     subq    #1,d0
  613.     beq.b    P61_ForcePAL
  614.     subq    #1,d0
  615.     beq.b    P61_NTSC
  616.     ifne    exec
  617.     move.l    4.w,a1
  618.     cmp.b    #60,$213(a1)    ;PowerSupplyFrequency
  619.     beq.b    P61_NTSC
  620.     endc
  621. P61_ForcePAL
  622.     move.l    #1773447,d0    ;PAL
  623.     bra.b    P61_setcia
  624. P61_NTSC
  625.     move.l    #1789773,d0    ;NTSC
  626. P61_setcia
  627.     move.l    d0,P61_timer(a3)
  628.     divu    #125,d0
  629.     move    d0,P61_thi2(a3)
  630.     sub    #$1f0*2,d0
  631.     move    d0,P61_thi(a3)
  632.  
  633.     ifeq    system
  634.     move    P61_thi2(a3),d0
  635.     move.b    d0,$400(a0)
  636.     lsr    #8,d0
  637.     move.b    d0,$500(a0)
  638.     lea    P61_intti(pc),a1
  639.     move.l    a1,P61_tintti(a3)
  640.     move.l    P61_vektori(pc),a2
  641.     move.l    a1,(a2)
  642.     move.b    #$83,$d00(a0)
  643.     move.b    #$11,$e00(a0)
  644.     endc
  645.     endc
  646.  
  647.     ifeq    system
  648.     move    #$e000,$9a(a6)
  649.     moveq    #0,d0
  650.     rts
  651.  
  652.     ifne    exec
  653. P61_liko
  654.     dc.l    $4E7A0801        ;MOVEC    VBR,d0
  655.     rte
  656.     endc
  657.     endc
  658.  
  659.     ifne    system
  660.     move.l    a6,-(sp)
  661.  
  662.     ifne    CIA
  663.     clr    P61_server(a3)
  664.     else
  665.     move    #1,P61_server(a3)
  666.     endc
  667.  
  668.     move.l    4.w,a6
  669.     moveq    #-1,d0
  670.     jsr    -$14a(a6)
  671.     move.b    d0,P61_sigbit(a3)
  672.     bmi    P61_err
  673.  
  674.     lea    P61_allocport(pc),a1
  675.     move.l    a1,P61_portti(a3)
  676.     move.b    d0,15(a1)
  677.     move.l    a1,-(sp)
  678.     suba.l    a1,a1
  679.     jsr    -$126(a6)
  680.     move.l    (sp)+,a1
  681.     move.l    d0,16(a1)
  682.     lea    P61_reqlist(pc),a0
  683.     move.l    a0,(a0)
  684.     addq.l    #4,(a0)
  685.     clr.l    4(a0)
  686.     move.l    a0,8(a0)
  687.  
  688.     lea    P61_dat(pc),a1
  689.     move.l    a1,P61_reqdata(a3)
  690.     lea    P61_allocreq(pc),a1
  691.     lea    P61_audiodev(pc),a0
  692.     moveq    #0,d0
  693.     moveq    #0,d1
  694.     jsr    -$1bc(a6)
  695.     tst.l    d0
  696.     bne    P61_err
  697.     st.b    P61_audioopen(a3)
  698.  
  699.     lea    P61_timerint(pc),a1
  700.     move.l    a1,P61_timerdata(a3)
  701.     lea    P61_lev6server(pc),a1
  702.     move.l    a1,P61_timerdata+8(a3)
  703.  
  704.     moveq    #0,d3
  705.     lea    P61_cianame(pc),a1
  706. P61_openciares
  707.     moveq    #0,d0
  708.     move.l    4.w,a6
  709.     jsr    -$1f2(a6)
  710.     move.l    d0,P61_ciares(a3)
  711.     beq.b    P61_err
  712.     move.l    d0,a6
  713.     lea    P61_timerinterrupt(pc),a1
  714.     moveq    #0,d0
  715.     jsr    -6(a6)
  716.     tst.l    d0
  717.     beq.b    P61_gottimer
  718.     addq.l    #4,d3
  719.     lea    P61_timerinterrupt(pc),a1
  720.     moveq    #1,d0
  721.     jsr    -6(a6)
  722.     tst.l    d0
  723.     bne.b    P61_err
  724.  
  725. P61_gottimer
  726.     lea    P61_craddr+8(pc),a6
  727.     move.l    P61_ciaaddr(pc,d3),d0
  728.     move.l    d0,(a6)
  729.     sub    #$100,d0
  730.     move.l    d0,-(a6)
  731.     moveq    #2,d3
  732.     btst    #9,d0
  733.     bne.b    P61_timerB
  734.     subq.b    #1,d3
  735.     add    #$100,d0
  736. P61_timerB
  737.     add    #$900,d0
  738.     move.l    d0,-(a6)
  739.     move.l    d0,a0
  740.     and.b    #%10000000,(a0)
  741.     move.b    d3,P61_timeropen(a3)
  742.     moveq    #0,d0
  743.     ifne    CIA
  744.     move.l    P61_craddr+4(pc),a1
  745.     move.b    P61_tlo(pc),(a1)
  746.     move.b    P61_thi(pc),$100(a1)
  747.     endc
  748.     or.b    #$19,(a0)
  749.     st    P61_timeron(a3)
  750. P61_pois
  751.     move.l    (sp)+,a6
  752.     rts
  753.  
  754. P61_err    moveq    #-1,d0
  755.     bra.b    P61_pois
  756.     rts
  757.  
  758. P61_ciaaddr
  759.     dc.l    $bfd500,$bfd700
  760.     endc
  761.  
  762. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  763. ;­         Call P61_End to stop the music        ­
  764. ;­   A6 --> Customchip baseaddress ($DFF000)    ­
  765. ;­        Uses D0/D1/A0/A1/A3        ­
  766. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  767.  
  768. P61_End    moveq    #0,d0
  769.     move    d0,$a8(a6)
  770.     move    d0,$b8(a6)
  771.     move    d0,$c8(a6)
  772.     move    d0,$d8(a6)
  773.     move    #$f,$96(a6)
  774.  
  775.     and.b    #~2,$bfe001
  776.     move.b    P61_ofilter(pc),d0
  777.     or.b    d0,$bfe001
  778.  
  779.     ifeq    system
  780.     move    #$2000,$9a(a6)
  781.     move.l    P61_vektori(pc),a0
  782.     move.l    P61_oldlev6(pc),(a0)
  783.     lea    $bfd000,a0
  784.     lea    P61_timers(pc),a1
  785.     move.b    (a1)+,$400(a0)
  786.     move.b    (a1)+,$500(a0)
  787.     move.b    (a1)+,$600(a0)
  788.     move.b    (a1)+,$700(a0)
  789.     move.b    #$10,$e00(a0)
  790.     move.b    #$10,$f00(a0)
  791.  
  792.     else
  793.  
  794.     clr    P61_timeron(a3)
  795.     move.l    a6,-(sp)
  796.     lea    P61_cn(pc),a3
  797.     moveq    #0,d0
  798.     move.b    P61_timeropen(pc),d0
  799.     beq.b    P61_rem1
  800.     move.l    P61_ciares(pc),a6
  801.     lea    P61_timerinterrupt(pc),a1
  802.     subq.b    #1,d0
  803.     jsr    -12(a6)
  804. P61_rem1
  805.     move.l    4.w,a6
  806.     tst.b    P61_audioopen(a3)
  807.     beq.b    P61_rem2
  808.     lea    P61_allocreq(pc),a1
  809.     jsr    -$1c2(a6)
  810.     clr.b    P61_audioopen(a3)
  811. P61_rem2
  812.     moveq    #0,d0
  813.     move.b    P61_sigbit(pc),d0
  814.     bmi.b    P61_rem3
  815.     jsr    -$150(a6)
  816.     st    P61_sigbit(a3)
  817. P61_rem3
  818.     move.l    (sp)+,a6
  819.     endc
  820.     rts
  821.  
  822.     ifne    fade
  823. P61_mfade
  824.     move    P61_Master(pc),d0
  825.     move    P61_temp0+P61_Shadow(pc),d1
  826.     mulu    d0,d1
  827.     lsr    #6,d1
  828.     move    d1,$a8(a6)
  829.  
  830.     ifgt    channels-1
  831.     move    P61_temp1+P61_Shadow(pc),d1
  832.     mulu    d0,d1
  833.     lsr    #6,d1
  834.     move    d1,$b8(a6)
  835.     endc
  836.  
  837.     ifgt    channels-2
  838.     move    P61_temp2+P61_Shadow(pc),d1
  839.     mulu    d0,d1
  840.     lsr    #6,d1
  841.     move    d1,$c8(a6)
  842.     endc
  843.  
  844.     ifgt    channels-3
  845.     move    P61_temp3+P61_Shadow(pc),d1
  846.     mulu    d0,d1
  847.     lsr    #6,d1
  848.     move    d1,$d8(a6)
  849.     endc
  850.     rts
  851.     endc
  852.     
  853.  
  854. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  855. ;­ Call P61_SetPosition to jump to a specific    ­
  856. ;­          position in the song.        ­
  857. ;­ D0.l --> Position                ­
  858. ;­ Starts from the beginning if out of limits.    ­
  859. ;­              Uses A0/A1/A3/D0-D3        ­
  860. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  861.  
  862.     ifne    jump
  863. P61_SetPosition
  864.     lea    P61_cn(pc),a3
  865.     ifne    P61_pl
  866.     clr    P61_plflag(a3)
  867.     endc
  868.     moveq    #0,d1
  869.     move.b    d0,d1
  870.     move.l    d1,d0
  871.     cmp    P61_slen(a3),d0
  872.     blo.b    .e
  873.     moveq    #0,d0
  874. .e    move    d0,P61_Pos(a3)
  875.     add.l    P61_possibase(pc),d0
  876.     move.l    d0,P61_spos(a3)
  877.  
  878.     moveq    #64,d0
  879.     move    d0,P61_rowpos(a3)
  880.     clr    P61_CRow(a3)
  881.     move.l    P61_spos(pc),a1
  882.     move.l    P61_patternbase(pc),a0
  883.     addq    #1,P61_Pos(a3)
  884.     move.b    (a1)+,d0
  885.     move.l    a1,P61_spos(a3)
  886.     move.l    P61_positionbase(pc),a1
  887.     move    d0,P61_Patt(a3)
  888.     lsl    #3,d0
  889.     add.l    d0,a1
  890.     movem    (a1),d0-d3
  891.     lea    (a0,d0.l),a1
  892.     move    d1,d0
  893.     move.l    a1,P61_ChaPos+P61_temp0(a3)
  894.     lea    (a0,d0.l),a1
  895.     move.l    a1,P61_ChaPos+P61_temp1(a3)
  896.     move    d2,d0
  897.     lea    (a0,d0.l),a1
  898.     move.l    a1,P61_ChaPos+P61_temp2(a3)
  899.     move    d3,d0
  900.     add.l    d0,a0
  901.     move.l    a0,P61_ChaPos+P61_temp3(a3)
  902.     rts
  903.     endc
  904.  
  905. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  906. ;­ Call P61_Music every frame to play the music    ­
  907. ;­      _NOT_ if CIA-version is used!        ­
  908. ;­ A6 --> Customchip baseaddress ($DFF000)    ­
  909. ;­              Uses A0-A5/D0-D7        ­
  910. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  911.  
  912. P61_Music
  913.     lea    P61_cn(pc),a3
  914.  
  915.     tst    P61_Play(a3)
  916.     bne.b    P61_ohitaaa
  917.     ifne    CIA
  918.     ifne    system
  919.     move.l    P61_craddr+4(pc),a0
  920.     move.b    P61_tlo2(pc),(a0)
  921.     move.b    P61_thi2(pc),$100(a0)
  922.     endc
  923.     endc
  924.     rts
  925.  
  926. P61_ohitaaa
  927.     ifne    fade
  928.     pea    P61_mfade(pc)
  929.     endc
  930.  
  931.     moveq    #Channel_Block_SIZE,d6
  932.     moveq    #16,d7
  933.  
  934.     move    (a3),d4
  935.     addq    #1,d4
  936.     cmp    P61_speed(pc),d4
  937.     beq    P61_playtime
  938.  
  939.     move    d4,(a3)
  940.  
  941. P61_delay
  942.     ifne    CIA
  943.     ifne    system
  944.     move.l    P61_craddr+4(pc),a0
  945.     move.b    P61_tlo2(pc),(a0)
  946.     move.b    P61_thi2(pc),$100(a0)
  947.     endc
  948.     endc
  949.  
  950.     lea    P61_temp0(pc),a5
  951.     lea    $a0(a6),a4
  952.  
  953.     moveq    #channels-1,d5
  954. P61_lopas
  955.     tst    P61_OnOff(a5)
  956.     beq    P61_contfxdone
  957.     moveq    #$f,d0
  958.     and    (a5),d0
  959.     ifeq    opt020
  960.     add    d0,d0
  961.     move    P61_jtab2(pc,d0),d0
  962.     else
  963.     move    P61_jtab2(pc,d0*2),d0
  964.     endc
  965.     jmp    P61_jtab2(pc,d0)
  966.  
  967. P61_jtab2
  968.     dc    P61_contfxdone-P61_jtab2
  969.  
  970.     ifne    P61_pu
  971.     dc    P61_portup-P61_jtab2
  972.     else
  973.     dc    P61_contfxdone-P61_jtab2
  974.     endc
  975.  
  976.     ifne    P61_pd
  977.     dc    P61_portdwn-P61_jtab2
  978.     else
  979.     dc    P61_contfxdone-P61_jtab2
  980.     endc
  981.  
  982.     ifne    P61_tp
  983.     dc    P61_toneport-P61_jtab2
  984.     else
  985.     dc    P61_contfxdone-P61_jtab2
  986.     endc
  987.  
  988.     ifne    P61_vib
  989.     dc    P61_vib2-P61_jtab2
  990.     else
  991.     dc    P61_contfxdone-P61_jtab2
  992.     endc
  993.  
  994.     ifne    P61_tpvs
  995.     dc    P61_tpochvslide-P61_jtab2
  996.     else
  997.     dc    P61_contfxdone-P61_jtab2
  998.     endc
  999.  
  1000.     ifne    P61_vbvs
  1001.     dc    P61_vibochvslide-P61_jtab2
  1002.     else
  1003.     dc    P61_contfxdone-P61_jtab2
  1004.     endc
  1005.  
  1006.     ifne    P61_tre
  1007.     dc    P61_tremo-P61_jtab2
  1008.     else
  1009.     dc    P61_contfxdone-P61_jtab2
  1010.     endc
  1011.  
  1012.     ifne    P61_arp
  1013.     dc    P61_arpeggio-P61_jtab2
  1014.     else
  1015.     dc    P61_contfxdone-P61_jtab2
  1016.     endc
  1017.  
  1018.     dc    P61_contfxdone-P61_jtab2
  1019.  
  1020.     ifne    P61_vs
  1021.     dc    P61_volslide-P61_jtab2
  1022.     else
  1023.     dc    P61_contfxdone-P61_jtab2
  1024.     endc
  1025.  
  1026.     dc    P61_contfxdone-P61_jtab2
  1027.     dc    P61_contfxdone-P61_jtab2
  1028.     dc    P61_contfxdone-P61_jtab2
  1029.  
  1030.     ifne    P61_ec
  1031.     dc    P61_contecommands-P61_jtab2
  1032.     else
  1033.     dc    P61_contfxdone-P61_jtab2
  1034.     endc
  1035.     dc    P61_contfxdone-P61_jtab2
  1036.  
  1037.     ifne    P61_ec
  1038. P61_contecommands
  1039.     move.b    P61_Info(a5),d0
  1040.     and    #$f0,d0
  1041.     lsr    #3,d0
  1042.     move    P61_etab2(pc,d0),d0
  1043.     jmp    P61_etab2(pc,d0)
  1044.  
  1045. P61_etab2
  1046.     dc    P61_contfxdone-P61_etab2
  1047.  
  1048.     ifne    P61_fsu
  1049.     dc    P61_fineup2-P61_etab2
  1050.     else
  1051.     dc    P61_contfxdone-P61_etab2
  1052.     endc
  1053.  
  1054.     ifne    P61_fsd
  1055.     dc    P61_finedwn2-P61_etab2
  1056.     else
  1057.     dc    P61_contfxdone-P61_etab2
  1058.     endc
  1059.  
  1060.     dc    P61_contfxdone-P61_etab2
  1061.     dc    P61_contfxdone-P61_etab2
  1062.  
  1063.     dc    P61_contfxdone-P61_etab2
  1064.     dc    P61_contfxdone-P61_etab2
  1065.  
  1066.     dc    P61_contfxdone-P61_etab2
  1067.     dc    P61_contfxdone-P61_etab2
  1068.  
  1069.     ifne    P61_rt
  1070.     dc    P61_retrig-P61_etab2
  1071.     else
  1072.     dc    P61_contfxdone-P61_etab2
  1073.     endc
  1074.  
  1075.     ifne    P61_fvu
  1076.     dc    P61_finevup2-P61_etab2
  1077.     else
  1078.     dc    P61_contfxdone-P61_etab2
  1079.     endc
  1080.  
  1081.     ifne    P61_fvd
  1082.     dc    P61_finevdwn2-P61_etab2
  1083.     else
  1084.     dc    P61_contfxdone-P61_etab2
  1085.     endc
  1086.  
  1087.     ifne    P61_nc
  1088.     dc    P61_notecut-P61_etab2
  1089.     else
  1090.     dc    P61_contfxdone-P61_etab2
  1091.     endc
  1092.  
  1093.     ifne    P61_nd
  1094.     dc    P61_notedelay-P61_etab2
  1095.     else
  1096.     dc    P61_contfxdone-P61_etab2
  1097.     endc
  1098.  
  1099.     dc    P61_contfxdone-P61_etab2
  1100.     dc    P61_contfxdone-P61_etab2
  1101.     endc
  1102.  
  1103.     ifne    P61_fsu
  1104. P61_fineup2
  1105.     tst    (a3)
  1106.     bne    P61_contfxdone
  1107.     moveq    #$f,d0
  1108.     and.b    P61_Info(a5),d0
  1109.     sub    d0,P61_Period(a5)
  1110.     moveq    #113,d0
  1111.     cmp    P61_Period(a5),d0
  1112.     ble.b    .jup
  1113.     move    d0,P61_Period(a5)
  1114. .jup    move    P61_Period(a5),6(a4)
  1115.     bra    P61_contfxdone
  1116.     endc
  1117.  
  1118.     ifne    P61_fsd
  1119. P61_finedwn2
  1120.     tst    (a3)
  1121.     bne    P61_contfxdone
  1122.     moveq    #$f,d0
  1123.     and.b    P61_Info(a5),d0
  1124.     add    d0,P61_Period(a5)
  1125.     cmp    #856,P61_Period(a5)
  1126.     ble.b    .jup
  1127.     move    #856,P61_Period(a5)
  1128. .jup    move    P61_Period(a5),6(a4)
  1129.     bra    P61_contfxdone
  1130.     endc
  1131.  
  1132.     ifne    P61_fvu
  1133. P61_finevup2
  1134.     tst    (a3)
  1135.     bne    P61_contfxdone
  1136.     moveq    #$f,d0
  1137.     and.b    P61_Info(a5),d0
  1138.     add    d0,P61_Volume(a5)
  1139.     moveq    #64,d0
  1140.     cmp    P61_Volume(a5),d0
  1141.     bge.b    .jup
  1142.     move    d0,P61_Volume(a5)
  1143. .jup    move    P61_Volume(a5),8(a4)
  1144.     bra    P61_contfxdone
  1145.     endc
  1146.  
  1147.     ifne    P61_fvd
  1148. P61_finevdwn2
  1149.     tst    (a3)
  1150.     bne    P61_contfxdone
  1151.     moveq    #$f,d0
  1152.     and.b    P61_Info(a5),d0
  1153.     sub    d0,P61_Volume(a5)
  1154.     bpl.b    .jup
  1155.     clr    P61_Volume(a5)
  1156. .jup    move    P61_Volume(a5),8(a4)
  1157.     bra    P61_contfxdone
  1158.     endc
  1159.  
  1160.     ifne    P61_nc
  1161. P61_notecut
  1162.     moveq    #$f,d0
  1163.     and.b    P61_Info(a5),d0
  1164.     cmp    (a3),d0
  1165.     bne    P61_contfxdone
  1166.     ifeq    fade
  1167.     clr    8(a4)
  1168.     else
  1169.     clr    P61_Shadow(a5)
  1170.     endc
  1171.     clr    P61_Volume(a5)
  1172.     bra    P61_contfxdone
  1173.     endc
  1174.  
  1175.     ifne    P61_nd
  1176. P61_notedelay
  1177.     moveq    #$f,d0
  1178.     and.b    P61_Info(a5),d0
  1179.     cmp    (a3),d0
  1180.     bne    P61_contfxdone
  1181.  
  1182.     moveq    #$7e,d0
  1183.     and.b    (a5),d0
  1184.     beq    P61_contfxdone
  1185.     move    P61_DMABit(a5),d0
  1186.     move    d0,$96(a6)
  1187.     or    d0,P61_dma(a3)
  1188.     move.l    P61_Sample(a5),a1        ;* Trigger *
  1189.     move.l    (a1)+,(a4)+            ;Pointer
  1190.     move    (a1),(a4)+            ;Length
  1191.     move    P61_Period(a5),(a4)
  1192.     subq.l    #6,a4
  1193.  
  1194.     ifeq    system
  1195.     lea    P61_dmason(pc),a1
  1196.     move.l    P61_vektori(pc),a0
  1197.     move.l    a1,(a0)
  1198.     move.b    #$f0,$bfd600
  1199.     move.b    #$01,$bfd700
  1200.     move.b    #$19,$bfdf00
  1201.     else
  1202.     move    #1,P61_server(a3)
  1203.     move.l    P61_craddr+4(pc),a1
  1204.     move.b    #$f0,(a1)
  1205.     move.b    #1,$100(a1)
  1206.     endc
  1207.     bra    P61_contfxdone
  1208.     endc
  1209.  
  1210.     ifne    P61_rt
  1211. P61_retrig
  1212.     subq    #1,P61_RetrigCount(a5)
  1213.     bne    P61_contfxdone
  1214.     move    P61_DMABit(a5),d0
  1215.     move    d0,$96(a6)
  1216.     or    d0,P61_dma(a3)
  1217.     move.l    P61_Sample(a5),a1        ;* Trigger *
  1218.     move.l    (a1)+,(a4)            ;Pointer
  1219.     move    (a1),4(a4)            ;Length
  1220.  
  1221.     ifeq    system
  1222.     lea    P61_dmason(pc),a1
  1223.     move.l    P61_vektori(pc),a0
  1224.     move.l    a1,(a0)
  1225.     move.b    #$f0,$bfd600
  1226.     move.b    #$01,$bfd700
  1227.     move.b    #$19,$bfdf00
  1228.     else
  1229.     move    #1,P61_server(a3)
  1230.     move.l    P61_craddr+4(pc),a1
  1231.     move.b    #$f0,(a1)
  1232.     move.b    #1,$100(a1)
  1233.     endc
  1234.  
  1235.     moveq    #$f,d0
  1236.     and.b    P61_Info(a5),d0
  1237.     move    d0,P61_RetrigCount(a5)
  1238.     bra    P61_contfxdone
  1239.     endc
  1240.  
  1241.     ifne    P61_arp
  1242. P61_arplist
  1243.  dc.b 0,1,-1,0,1,-1,0,1,-1,0,1,-1,0,1,-1,0,1,-1,0,1,-1,0,1,-1,0,1,-1,0,1,-1,0,1
  1244.  
  1245. P61_arpeggio
  1246.     move    (a3),d0
  1247.     move.b    P61_arplist(pc,d0),d0
  1248.     beq.b    .arp0
  1249.     bmi.b    .arp1
  1250.  
  1251.     move.b    P61_Info(a5),d0
  1252.     lsr    #4,d0
  1253.     bra.b    .arp3
  1254.  
  1255. .arp0    move    P61_Note(a5),d0
  1256.     move    P61_periods(pc,d0),6(a4)
  1257.     bra    P61_contfxdone
  1258.  
  1259. .arp1    moveq    #$f,d0
  1260.     and.b    P61_Info(a5),d0
  1261.  
  1262. .arp3    add    d0,d0
  1263.     add    P61_Note(a5),d0
  1264.     move    P61_periods(pc,d0),6(a4)
  1265.     bra    P61_contfxdone
  1266.     endc
  1267.  
  1268. P61_periods
  1269.     ifne    P61_ft
  1270.     incbin    periods
  1271.     else
  1272.     incbin    periods.nft
  1273.     endc
  1274.  
  1275.     ifne    P61_vs
  1276. P61_volslide
  1277.     move.b    P61_Info(a5),d0
  1278.     sub.b    d0,P61_Volume+1(a5)
  1279.     bpl.b    .test
  1280.     clr    P61_Volume(a5)
  1281.     ifeq    fade
  1282.     clr    8(a4)
  1283.     else
  1284.     clr    P61_Shadow(a5)
  1285.     endc
  1286.     bra    P61_contfxdone
  1287. .test    moveq    #64,d0
  1288.     cmp    P61_Volume(a5),d0
  1289.     bge.b    .ncs
  1290.     move    d0,P61_Volume(a5)
  1291.     ifeq    fade
  1292.     move    d0,8(a4)
  1293.     else
  1294.     move    d0,P61_Shadow(a5)
  1295.     endc
  1296.     bra.b    P61_contfxdone
  1297. .ncs    ifeq    fade
  1298.     move    P61_Volume(a5),8(a4)
  1299.     else
  1300.     move    P61_Volume(a5),P61_Shadow(a5)
  1301.     endc
  1302.     bra.b    P61_contfxdone
  1303.     endc
  1304.  
  1305.     ifne    P61_tpvs
  1306. P61_tpochvslide
  1307.     move.b    P61_Info(a5),d0
  1308.     sub.b    d0,P61_Volume+1(a5)
  1309.     bpl.b    .test
  1310.     clr    P61_Volume(a5)
  1311.     ifeq    fade
  1312.     clr    8(a4)
  1313.     else
  1314.     clr    P61_Shadow(a5)
  1315.     endc
  1316.     bra.b    P61_toneport
  1317. .test    moveq    #64,d0
  1318.     cmp    P61_Volume(a5),d0
  1319.     bge.b    .ncs
  1320.     move    d0,P61_Volume(a5)
  1321. .ncs    ifeq    fade
  1322.     move    P61_Volume(a5),8(a4)
  1323.     else
  1324.     move    P61_Volume(a5),P61_Shadow(a5)
  1325.     endc
  1326.     endc
  1327.  
  1328.     ifne    P61_tp
  1329. P61_toneport
  1330.     move    P61_ToPeriod(a5),d0
  1331.     beq.b    P61_contfxdone
  1332.     move    P61_TPSpeed(a5),d1
  1333.     cmp    P61_Period(a5),d0
  1334.     blt.b    .topoup
  1335.  
  1336.     add    d1,P61_Period(a5)
  1337.     cmp    P61_Period(a5),d0
  1338.     bgt.b    .setper
  1339.     move    d0,P61_Period(a5)
  1340.     clr    P61_ToPeriod(a5)
  1341.     move    d0,6(a4)
  1342.     bra.b    P61_contfxdone
  1343.  
  1344. .topoup
  1345.     sub    d1,P61_Period(a5)
  1346.     cmp    P61_Period(a5),d0
  1347.     blt.b    .setper
  1348.     move    d0,P61_Period(a5)
  1349.     clr    P61_ToPeriod(a5)
  1350. .setper
  1351.     move    P61_Period(a5),6(a4)
  1352.     else
  1353.     nop
  1354.     endc
  1355.  
  1356. P61_contfxdone
  1357.     ifne    P61_il
  1358.     bsr    P61_funk2
  1359.     endc
  1360.  
  1361.     add.l    d6,a5
  1362.     add.l    d7,a4
  1363.     dbf    d5,P61_lopas
  1364.  
  1365.     cmp    P61_speed2(pc),d4
  1366.     beq.b    P61_preplay
  1367.     rts
  1368.  
  1369.     ifne    P61_pu
  1370. P61_portup
  1371.     moveq    #0,D0
  1372.     move.b    P61_Info(a5),d0
  1373.     sub    d0,P61_Period(a5)
  1374.     moveq    #113,d0
  1375.     cmp    P61_Period(a5),d0
  1376.     ble.b    .skip
  1377.     move    d0,P61_Period(a5)
  1378.     move    d0,6(a4)
  1379.     bra.b    P61_contfxdone
  1380. .skip
  1381.     move    P61_Period(a5),6(a4)
  1382.     bra.b    P61_contfxdone
  1383.     endc
  1384.  
  1385.     ifne    P61_pd
  1386. P61_portdwn
  1387.     moveq    #0,d0
  1388.     move.b    P61_Info(a5),d0
  1389.     add    d0,P61_Period(a5)
  1390.     cmp    #856,P61_Period(a5)
  1391.     ble.b    .skip
  1392.     move    #856,d0
  1393.     move    d0,P61_Period(a5)
  1394.     move    d0,6(a4)
  1395.     bra.b    P61_contfxdone
  1396. .skip
  1397.     move    P61_Period(a5),6(a4)
  1398.     bra.b    P61_contfxdone
  1399.     endc
  1400.  
  1401.     ifne    P61_pde
  1402. P61_return
  1403.     rts
  1404.  
  1405. P61_preplay
  1406.     tst    P61_pdflag(a3)
  1407.     bne.b    P61_return
  1408.     else
  1409. P61_preplay
  1410.     endc
  1411.  
  1412.     lea    P61_temp0(pc),a5
  1413.     lea    P61_samples-16(pc),a0
  1414.  
  1415.     moveq    #channels-1,d5
  1416. P61_loaps
  1417.     ifne    P61_pl
  1418.     lea    P61_TData(a5),a1
  1419.     move    2(a5),(a1)+
  1420.     move.l    P61_ChaPos(a5),(a1)+
  1421.     move.l    P61_TempPos(a5),(a1)+
  1422.     move    P61_TempLen(a5),(a1)
  1423.     endc
  1424.  
  1425.     move.b    P61_Pack(a5),d0
  1426.     and.b    #$3f,d0
  1427.     beq.b    P61_takeone
  1428.  
  1429.     tst.b    P61_Pack(a5)
  1430.     bmi.b    .keepsame
  1431.  
  1432.     subq.b    #1,P61_Pack(a5)
  1433.     clr    P61_OnOff(a5)            ; Empty row
  1434.     add.l    d6,a5
  1435.     dbf    d5,P61_loaps
  1436.     rts
  1437.  
  1438. .keepsame
  1439.     subq.b    #1,P61_Pack(a5)
  1440.     bra    P61_dko
  1441.  
  1442. P61_takeone
  1443.     tst.b    P61_TempLen+1(a5)
  1444.     beq    P61_takenorm
  1445.  
  1446.     subq.b    #1,P61_TempLen+1(a5)
  1447.     move.l    P61_TempPos(a5),a2
  1448.  
  1449. P61_jedi
  1450.     move.b    (a2)+,d0
  1451.     moveq    #%01100000,d1
  1452.     and.b    d0,d1
  1453.     cmp.b    #%01100000,d1
  1454.     bne.b    .all
  1455.  
  1456.     moveq    #%01110000,d1
  1457.     and.b    d0,d1
  1458.     cmp.b    #%01110000,d1
  1459.     bne.b    .cmd
  1460.  
  1461.     moveq    #%01111000,d1
  1462.     and.b    d0,d1
  1463.     cmp.b    #%01111000,d1
  1464.     bne.b    .note
  1465.  
  1466. .empty    clr    P61_OnOff(a5)            ; Empty row
  1467.     clr    (a5)+
  1468.     clr.b    (a5)+
  1469.     tst.b    d0
  1470.     bpl.b    .ex
  1471.     move.b    (a2)+,(a5)            ; Compression info
  1472.     bra.b    .ex
  1473.  
  1474. .all    move.b    d0,(a5)+
  1475.     ifeq    opt020
  1476.     move.b    (a2)+,(a5)+
  1477.     move.b    (a2)+,(a5)+
  1478.     else
  1479.     move    (a2)+,(a5)+
  1480.     endc
  1481.     tst.b    d0
  1482.     bpl.b    .ex
  1483.     move.b    (a2)+,(a5)            ; Compression info
  1484.     bra.b    .ex
  1485.  
  1486. .cmd    moveq    #$f,d1
  1487.     and    d0,d1
  1488.     move    d1,(a5)+            ; cmd
  1489.     move.b    (a2)+,(a5)+            ; info
  1490.     tst.b    d0
  1491.     bpl.b    .ex
  1492.     move.b    (a2)+,(a5)            ; Compression info
  1493.     bra.b    .ex
  1494.  
  1495. .note    moveq    #7,d1
  1496.     and    d0,d1
  1497.     lsl    #8,d1
  1498.     move.b    (a2)+,d1
  1499.     lsl    #4,d1
  1500.     move    d1,(a5)+
  1501.     clr.b    (a5)+    
  1502.     tst.b    d0
  1503.     bpl.b    .ex
  1504.     move.b    (a2)+,(a5)            ; Compression info
  1505. .ex    subq.l    #3,a5
  1506.     move.l    a2,P61_TempPos(a5)
  1507.     bra    P61_dko
  1508.  
  1509.  
  1510. P61_takenorm
  1511.     move.l    P61_ChaPos(a5),a2
  1512.  
  1513.     move.b    (a2)+,d0
  1514.     moveq    #%01100000,d1
  1515.     and.b    d0,d1
  1516.     cmp.b    #%01100000,d1
  1517.     bne.b    .all
  1518.  
  1519.     moveq    #%01110000,d1
  1520.     and.b    d0,d1
  1521.     cmp.b    #%01110000,d1
  1522.     bne.b    .cmd
  1523.  
  1524.     moveq    #%01111000,d1
  1525.     and.b    d0,d1
  1526.     cmp.b    #%01111000,d1
  1527.     bne.b    .note
  1528.  
  1529. .empty    clr    P61_OnOff(a5)            ; Empty row
  1530.     clr    (a5)+
  1531.     clr.b    (a5)+
  1532.     tst.b    d0
  1533.     bpl.b    .proccomp
  1534.     move.b    (a2)+,(a5)            ; Compression info
  1535.     bra.b    .proccomp
  1536.  
  1537.  
  1538. .all    move.b    d0,(a5)+
  1539.     ifeq    opt020
  1540.     move.b    (a2)+,(a5)+
  1541.     move.b    (a2)+,(a5)+
  1542.     else
  1543.     move    (a2)+,(a5)+
  1544.     endc
  1545.     tst.b    d0
  1546.     bpl.b    .proccomp
  1547.     move.b    (a2)+,(a5)            ; Compression info
  1548.     bra.b    .proccomp
  1549.  
  1550. .cmd    moveq    #$f,d1
  1551.     and    d0,d1
  1552.     move    d1,(a5)+            ; cmd
  1553.     move.b    (a2)+,(a5)+            ; info
  1554.     tst.b    d0
  1555.     bpl.b    .proccomp
  1556.     move.b    (a2)+,(a5)            ; Compression info
  1557.     bra.b    .proccomp
  1558.  
  1559. .note    moveq    #7,d1
  1560.     and    d0,d1
  1561.     lsl    #8,d1
  1562.     move.b    (a2)+,d1
  1563.     lsl    #4,d1
  1564.     move    d1,(a5)+
  1565.     clr.b    (a5)+    
  1566.     tst.b    d0
  1567.     bpl.b    .proccomp
  1568.     move.b    (a2)+,(a5)            ; Compression info
  1569.  
  1570. .proccomp
  1571.     subq.l    #3,a5
  1572.     move.l    a2,P61_ChaPos(a5)
  1573.  
  1574.     tst.b    d0
  1575.     bpl.b    P61_dko
  1576.  
  1577.     move.b    3(a5),d0
  1578.     move.b    d0,d1
  1579.     and    #%11000000,d1
  1580.     beq.b    P61_dko                ; Empty datas
  1581.     cmp.b    #%10000000,d1
  1582.     beq.b    P61_dko                ; Same datas
  1583.  
  1584.     clr.b    3(a5)
  1585.     and    #$3f,d0
  1586.     move.b    d0,P61_TempLen+1(a5)
  1587.  
  1588.     cmp.b    #%11000000,d1
  1589.     beq.b    .bit16                ; 16-bit
  1590.  
  1591.     moveq    #0,d0                ; 8-bit
  1592.     move.b    (a2)+,d0
  1593.     move.l    a2,P61_ChaPos(a5)
  1594.     sub.l    d0,a2
  1595.     bra    P61_jedi
  1596.  
  1597. .bit16    moveq    #0,d0
  1598.     ifeq    opt020
  1599.     move.b    (a2)+,d0
  1600.     lsl    #8,d0
  1601.     move.b    (a2)+,d0
  1602.     else
  1603.     move    (a2)+,d0
  1604.     endc
  1605.  
  1606.     move.l    a2,P61_ChaPos(a5)
  1607.     sub.l    d0,a2
  1608.     bra    P61_jedi
  1609.  
  1610.  
  1611. P61_dko    st    P61_OnOff(a5)
  1612.     move    (a5),d0
  1613.     and    #$1f0,d0
  1614.     beq.b    .koto
  1615.     lea    (a0,d0),a1
  1616.     move.l    a1,P61_Sample(a5)
  1617.     ifne    P61_ft
  1618.     move.l    P61_SampleVolume(a1),P61_Volume(a5)
  1619.     else
  1620.     move    P61_SampleVolume(a1),P61_Volume(a5)
  1621.     endc
  1622.     ifne    P61_il
  1623.     move.l    P61_RepeatOffset(a1),P61_Wave(a5)
  1624.     endc
  1625.     ifne    P61_sof
  1626.     clr    P61_Offset(a5)
  1627.     endc
  1628.  
  1629. .koto    add.l    d6,a5
  1630.     dbf    d5,P61_loaps
  1631.     rts
  1632.  
  1633. P61_playtime
  1634.     clr    (a3)
  1635.  
  1636.     ifne    P61_pde
  1637.     tst    P61_pdelay(a3)
  1638.     beq.b    .djdj
  1639.     subq    #1,P61_pdelay(a3)
  1640.     bne    P61_delay
  1641.     tst    P61_speedis1(a3)
  1642.     bne    P61_delay
  1643.     clr    P61_pdflag(a3)
  1644.     bra    P61_delay
  1645. .djdj
  1646.     clr    P61_pdflag(a3)
  1647.     endc
  1648.  
  1649.     tst    P61_speedis1(a3)
  1650.     beq.b    .mo
  1651.     bsr    P61_preplay
  1652.  
  1653. .mo    lea    P61_temp0(pc),a5
  1654.     lea    $a0(a6),a4
  1655.  
  1656.     ifeq    system
  1657.     lea    P61_dmason(pc),a1
  1658.     move.l    P61_vektori(pc),a0
  1659.     move.l    a1,(a0)
  1660.     move.b    #$f0,$bfd600
  1661.     move.b    #$01,$bfd700
  1662.     move.b    #$19,$bfdf00
  1663.     else
  1664.     move    #1,P61_server(a3)
  1665.     move.l    P61_craddr+4(pc),a1
  1666.     move.b    #$f0,(a1)
  1667.     move.b    #1,$100(a1)
  1668.     endc
  1669.  
  1670.     lea    P61_periods(pc),a2
  1671.  
  1672.     moveq    #0,d4
  1673.     moveq    #channels-1,d5
  1674. P61_los    tst    P61_OnOff(a5)
  1675.     beq    P61_nocha
  1676.  
  1677.     moveq    #$f,d0
  1678.     and    (a5),d0
  1679.     lea    P61_jtab(pc),a1
  1680.     add    d0,d0
  1681.     add.l    d0,a1
  1682.     add    (a1),a1
  1683.     jmp    (a1)
  1684.  
  1685. P61_fxdone
  1686.     moveq    #$7e,d0
  1687.     and.b    (a5),d0
  1688.     beq.b    P61_nocha
  1689.     ifne    P61_vib
  1690.     clr.b    P61_VibPos(a5)
  1691.     endc
  1692.     ifne    P61_tre
  1693.     clr.b    P61_TrePos(a5)
  1694.     endc
  1695.  
  1696.      ifne    P61_ft
  1697.     add    P61_Fine(a5),d0
  1698.     endc
  1699.     move    d0,P61_Note(a5)
  1700.     move    (a2,d0),P61_Period(a5)
  1701.  
  1702. P61_zample
  1703.     ifne    P61_sof
  1704.     tst    P61_Offset(a5)
  1705.     bne    P61_pek
  1706.     endc
  1707.  
  1708.     or    P61_DMABit(a5),d4
  1709.     move    d4,$96(a6)
  1710.     move.l    P61_Sample(a5),a1        ;* Trigger *
  1711.     move.l    (a1)+,(a4)            ;Pointer
  1712.     move    (a1),4(a4)            ;Length
  1713.  
  1714. P61_nocha
  1715.     ifeq    fade
  1716.     move.l    P61_Period(a5),6(a4)
  1717.     else
  1718.     move    P61_Period(a5),6(a4)
  1719.     move    P61_Volume(a5),P61_Shadow(a5)
  1720.     endc
  1721.  
  1722. P61_skip
  1723.     ifne    P61_il
  1724.     bsr    P61_funk2
  1725.     endc
  1726.  
  1727.     add.l    d6,a5
  1728.     add.l    d7,a4
  1729.     dbf    d5,P61_los
  1730.  
  1731.     move.b    d4,P61_dma+1(a3)
  1732.  
  1733.     ifne    P61_pl
  1734.     tst.b    P61_plflag+1(a3)
  1735.     beq.b    P61_ohittaa
  1736.  
  1737.     lea    P61_temp0(pc),a1
  1738.     lea    P61_looppos(pc),a0
  1739.     moveq    #channels-1,d0
  1740. .talt    move.b    1(a0),3(a1)
  1741.     addq.l    #2,a0
  1742.     move.l    (a0)+,P61_ChaPos(a1)
  1743.     move.l    (a0)+,P61_TempPos(a1)
  1744.     move    (a0)+,P61_TempLen(a1)
  1745.     add.l    d6,a1
  1746.     dbf    d0,.talt
  1747.  
  1748.     move    P61_plrowpos(pc),P61_rowpos(a3)
  1749.     clr.b    P61_plflag+1(a3)
  1750.     moveq    #63,d0
  1751.     sub    P61_rowpos(a3),d0
  1752.     move    d0,P61_CRow(a3)
  1753.     rts
  1754.     endc
  1755.  
  1756. P61_ohittaa
  1757.     subq    #1,P61_rowpos(a3)
  1758.     bmi.b    P61_nextpattern
  1759.     moveq    #63,d0
  1760.     sub    P61_rowpos(a3),d0
  1761.     move    d0,P61_CRow(a3)
  1762.     rts
  1763.  
  1764. P61_nextpattern
  1765.     ifne    P61_pl
  1766.     clr    P61_plflag(a3)
  1767.     endc
  1768.     move.l    P61_patternbase(pc),a4
  1769.     moveq    #63,d0
  1770.     move    d0,P61_rowpos(a3)
  1771.     clr    P61_CRow(a3)
  1772.     move.l    P61_spos(pc),a1
  1773.     addq    #1,P61_Pos(a3)
  1774.     move.b    (a1)+,d0
  1775.     bpl.b    P61_dk
  1776.     move.l    P61_possibase(pc),a1
  1777.     move.b    (a1)+,d0
  1778.     clr    P61_Pos(a3)
  1779. P61_dk    move.l    a1,P61_spos(a3)
  1780.     move    d0,P61_Patt(a3)
  1781.     lsl    #3,d0
  1782.     move.l    P61_positionbase(pc),a1
  1783.     add.l    d0,a1
  1784.  
  1785.     move    (a1)+,d0
  1786.     lea    (a4,d0.l),a2
  1787.     move.l    a2,P61_ChaPos+P61_temp0(a3)
  1788.     move    (a1)+,d0
  1789.     lea    (a4,d0.l),a2
  1790.     move.l    a2,P61_ChaPos+P61_temp1(a3)
  1791.     move    (a1)+,d0
  1792.     lea    (a4,d0.l),a2
  1793.     move.l    a2,P61_ChaPos+P61_temp2(a3)
  1794.     move    (a1),d0
  1795.     add.l    d0,a4
  1796.     move.l    a4,P61_ChaPos+P61_temp3(a3)
  1797.     rts
  1798.  
  1799.     ifne    P61_tp
  1800. P61_settoneport
  1801.     move.b    P61_Info(a5),d0
  1802.     beq.b    P61_toponochange
  1803.     move.b    d0,P61_TPSpeed+1(a5)
  1804. P61_toponochange
  1805.     moveq    #$7e,d0
  1806.     and.b    (a5),d0
  1807.     beq    P61_nocha
  1808.     add    P61_Fine(a5),d0
  1809.     move    d0,P61_Note(a5)
  1810.     move    (a2,d0),P61_ToPeriod(a5)
  1811.     bra    P61_nocha
  1812.     endc
  1813.  
  1814.     ifne    P61_sof
  1815. P61_sampleoffse
  1816.     moveq    #0,d1
  1817.     move    #$ff00,d1
  1818.     and    2(a5),d1
  1819.     bne.b    .deq
  1820.     move    P61_LOffset(a5),d1
  1821. .deq    move    d1,P61_LOffset(a5)
  1822.     add    d1,P61_Offset(a5)
  1823.  
  1824.     moveq    #$7e,d0
  1825.     and.b    (a5),d0
  1826.     beq    P61_nocha
  1827.  
  1828.     move    P61_Offset(a5),d2
  1829.     add    d1,P61_Offset(a5)        ; THIS IS A PT-FEATURE!
  1830.     move    d2,d1
  1831.  
  1832.     ifne    P61_vib
  1833.     clr.b    P61_VibPos(a5)
  1834.     endc
  1835.     ifne    P61_tre
  1836.     clr.b    P61_TrePos(a5)
  1837.     endc
  1838.  
  1839.     ifne    P61_ft
  1840.     add    P61_Fine(a5),d0
  1841.     endc
  1842.     move    d0,P61_Note(a5)
  1843.     move    (a2,d0),P61_Period(a5)
  1844.     bra.b    P61_hup
  1845.  
  1846. P61_pek    moveq    #0,d1
  1847.     move    P61_Offset(a5),d1
  1848. P61_hup    or    P61_DMABit(a5),d4
  1849.     move    d4,$96(a6)
  1850.     move.l    P61_Sample(a5),a1        ;* Trigger *
  1851.     move.l    (a1)+,d0
  1852.     add.l    d1,d0
  1853.     move.l    d0,(a4)                ;Pointer
  1854.     lsr    #1,d1
  1855.     move    (a1),d0
  1856.     sub    d1,d0
  1857.     bpl.b    P61_offok
  1858.     move.l    -4(a1),(a4)            ;Pointer is over the end
  1859.     moveq    #1,d0
  1860. P61_offok
  1861.     move    d0,4(a4)            ;Length
  1862.     bra    P61_nocha
  1863.     endc
  1864.  
  1865.     ifne    P61_vl
  1866. P61_volum
  1867.     move.b    P61_Info(a5),P61_Volume+1(a5)
  1868.     bra    P61_fxdone
  1869.     endc
  1870.  
  1871.     ifne    P61_pj
  1872. P61_posjmp
  1873.     moveq    #0,d0
  1874.     move.b    P61_Info(a5),d0
  1875.     cmp    P61_slen(a3),d0
  1876.     blo.b    .e
  1877.     moveq    #0,d0
  1878. .e    move    d0,P61_Pos(a3)
  1879.     add.l    P61_possibase(pc),d0
  1880.     move.l    d0,P61_spos(a3)
  1881.     endc
  1882.  
  1883.     ifne    P61_pb
  1884. P61_pattbreak
  1885.     moveq    #64,d0
  1886.     move    d0,P61_rowpos(a3)
  1887.     clr    P61_CRow(a3)
  1888.     move.l    P61_spos(pc),a1
  1889.     move.l    P61_patternbase(pc),a0
  1890.     addq    #1,P61_Pos(a3)
  1891.     move.b    (a1)+,d0
  1892.     bpl.b    P61_dk2
  1893.     move.l    P61_possibase(pc),a1
  1894.     move.b    (a1)+,d0
  1895.     clr    P61_Pos(a3)
  1896. P61_dk2    move.l    a1,P61_spos(a3)
  1897.     move.l    P61_positionbase(pc),a1
  1898.     move    d0,P61_Patt(a3)
  1899.     lsl    #3,d0
  1900.     add.l    d0,a1
  1901.     movem    (a1),d0-d3
  1902.     lea    (a0,d0.l),a1
  1903.     move    d1,d0
  1904.     move.l    a1,P61_ChaPos+P61_temp0(a3)
  1905.     lea    (a0,d0.l),a1
  1906.     move.l    a1,P61_ChaPos+P61_temp1(a3)
  1907.     move    d2,d0
  1908.     lea    (a0,d0.l),a1
  1909.     move.l    a1,P61_ChaPos+P61_temp2(a3)
  1910.     move    d3,d0
  1911.     add.l    d0,a0
  1912.     move.l    a0,P61_ChaPos+P61_temp3(a3)
  1913.     bra    P61_fxdone
  1914.     endc
  1915.  
  1916.     ifne    P61_vib
  1917. P61_vibrato
  1918.     move.b    P61_Info(a5),d0
  1919.     beq    P61_fxdone
  1920.     move.b    d0,d1
  1921.     move.b    P61_VibCmd(a5),d2
  1922.     and.b    #$f,d0
  1923.     beq.b    P61_vibskip
  1924.     and.b    #$f0,d2
  1925.     or.b    d0,d2
  1926. P61_vibskip
  1927.     and.b    #$f0,d1
  1928.     beq.b    P61_vibskip2
  1929.     and.b    #$f,d2
  1930.     or.b    d1,d2
  1931. P61_vibskip2
  1932.     move.b    d2,P61_VibCmd(a5)
  1933.     bra    P61_fxdone
  1934.     endc
  1935.  
  1936.     ifne    P61_tre
  1937. P61_settremo
  1938.     move.b    P61_Info(a5),d0
  1939.     beq    P61_fxdone
  1940.     move.b    d0,d1
  1941.     move.b    P61_TreCmd(a5),d2
  1942.     moveq    #$f,d3
  1943.     and.b    d3,d0
  1944.     beq.b    P61_treskip
  1945.     and.b    #$f0,d2
  1946.     or.b    d0,d2
  1947. P61_treskip
  1948.     and.b    #$f0,d1
  1949.     beq.b    P61_treskip2
  1950.     and.b    d3,d2
  1951.     or.b    d1,d2
  1952. P61_treskip2
  1953.     move.b    d2,P61_TreCmd(a5)
  1954.     bra    P61_fxdone
  1955.     endc
  1956.  
  1957.     ifne    P61_ec
  1958. P61_ecommands
  1959.     move.b    P61_Info(a5),d0
  1960.     and.b    #$f0,d0
  1961.     lsr    #3,d0
  1962.     move    P61_etab(pc,d0),d0
  1963.     jmp    P61_etab(pc,d0)
  1964.  
  1965. P61_etab
  1966.     ifne    P61_fi
  1967.     dc    P61_filter-P61_etab
  1968.     else
  1969.     dc    P61_fxdone-P61_etab
  1970.     endc
  1971.  
  1972.     ifne    P61_fsu
  1973.     dc    P61_fineup-P61_etab
  1974.     else
  1975.     dc    P61_fxdone-P61_etab
  1976.     endc
  1977.  
  1978.     ifne    P61_fsd
  1979.     dc    P61_finedwn-P61_etab
  1980.     else
  1981.     dc    P61_fxdone-P61_etab
  1982.     endc
  1983.  
  1984.     dc    P61_fxdone-P61_etab
  1985.     dc    P61_fxdone-P61_etab
  1986.  
  1987.     ifne    P61_sft
  1988.     dc    P61_setfinetune-P61_etab
  1989.     else
  1990.     dc    P61_fxdone-P61_etab
  1991.     endc
  1992.  
  1993.     ifne    P61_pl
  1994.     dc    P61_patternloop-P61_etab
  1995.     else
  1996.     dc    P61_fxdone-P61_etab
  1997.     endc
  1998.  
  1999.     dc    P61_fxdone-P61_etab
  2000.  
  2001.     ifne    P61_timing
  2002.     dc    P61_sete8-P61_etab
  2003.     else
  2004.     dc    P61_fxdone-P61_etab
  2005.     endc
  2006.  
  2007.     ifne    P61_rt
  2008.     dc    P61_setretrig-P61_etab
  2009.     else
  2010.     dc    P61_fxdone-P61_etab
  2011.     endc
  2012.  
  2013.     ifne    P61_fvu
  2014.     dc    P61_finevup-P61_etab
  2015.     else
  2016.     dc    P61_fxdone-P61_etab
  2017.     endc
  2018.  
  2019.     ifne    P61_fvd
  2020.     dc    P61_finevdwn-P61_etab
  2021.     else
  2022.     dc    P61_fxdone-P61_etab
  2023.     endc
  2024.  
  2025.     dc    P61_fxdone-P61_etab
  2026.  
  2027.     ifne    P61_nd
  2028.     dc    P61_ndelay-P61_etab
  2029.     else
  2030.     dc    P61_fxdone-P61_etab
  2031.     endc
  2032.  
  2033.     ifne    P61_pde
  2034.     dc    P61_pattdelay-P61_etab
  2035.     else
  2036.     dc    P61_fxdone-P61_etab
  2037.     endc
  2038.  
  2039.     ifne    P61_il
  2040.     dc    P61_funk-P61_etab
  2041.     else
  2042.     dc    P61_fxdone-P61_etab
  2043.     endc
  2044.     endc
  2045.  
  2046.     ifne    P61_fi
  2047. P61_filter
  2048.     move.b    P61_Info(a5),d0
  2049.     and.b    #$fd,$bfe001
  2050.     or.b    d0,$bfe001
  2051.     bra    P61_fxdone
  2052.     endc
  2053.  
  2054.     ifne    P61_fsu
  2055. P61_fineup
  2056.     P61_getnote
  2057.  
  2058.     moveq    #$f,d0
  2059.     and.b    P61_Info(a5),d0
  2060.     sub    d0,P61_Period(a5)
  2061.     moveq    #113,d0
  2062.     cmp    P61_Period(a5),d0
  2063.     ble.b    .jup
  2064.     move    d0,P61_Period(a5)
  2065. .jup    moveq    #$7e,d0
  2066.     and.b    (a5),d0
  2067.     bne    P61_zample
  2068.     bra    P61_nocha
  2069.     endc
  2070.  
  2071.     ifne    P61_fsd
  2072. P61_finedwn
  2073.     P61_getnote
  2074.  
  2075.     moveq    #$f,d0
  2076.     and.b    P61_Info(a5),d0
  2077.     add    d0,P61_Period(a5)
  2078.     cmp    #856,P61_Period(a5)
  2079.     ble.b    .jup
  2080.     move    #856,P61_Period(a5)
  2081. .jup    moveq    #$7e,d0
  2082.     and.b    (a5),d0
  2083.     bne    P61_zample
  2084.     bra    P61_nocha
  2085.     endc
  2086.  
  2087.     ifne    P61_sft
  2088. P61_setfinetune
  2089.     moveq    #$f,d0
  2090.     and.b    P61_Info(a5),d0
  2091.     ifeq    opt020
  2092.     add    d0,d0
  2093.     move    P61_mulutab(pc,d0),P61_Fine(a5)
  2094.     else
  2095.     move    P61_mulutab(pc,d0*2),P61_Fine(a5)
  2096.     endc
  2097.     bra    P61_fxdone
  2098.  
  2099. P61_mulutab
  2100.     dc    0,74,148,222,296,370,444,518,592,666,740,814,888,962,1036,1110
  2101.     endc
  2102.  
  2103.     ifne    P61_pl
  2104. P61_patternloop
  2105.     moveq    #$f,d0
  2106.     and.b    P61_Info(a5),d0
  2107.     beq.b    P61_setloop
  2108.  
  2109.     tst.b    P61_plflag(a3)
  2110.     bne.b    P61_noset
  2111.  
  2112.     move    d0,P61_plcount(a3)
  2113.     st.b    P61_plflag(a3)
  2114. P61_noset
  2115.     tst    P61_plcount(a3)
  2116.     bne.b    P61_looppaa
  2117.     clr.b    P61_plflag(a3)
  2118.     bra    P61_fxdone
  2119.     
  2120. P61_looppaa
  2121.     st.b    P61_plflag+1(a3)
  2122.     subq    #1,P61_plcount(a3)
  2123.     bra    P61_fxdone
  2124.  
  2125. P61_setloop
  2126.     tst.b    P61_plflag(a3)
  2127.     bne    P61_fxdone
  2128.     move    P61_rowpos(pc),P61_plrowpos(a3)
  2129.     lea    P61_temp0+P61_TData(pc),a1
  2130.     lea    P61_looppos(pc),a0
  2131.     moveq    #channels-1,d0
  2132. .talt    move.l    (a1)+,(a0)+
  2133.     move.l    (a1)+,(a0)+
  2134.     move.l    (a1),(a0)+
  2135.     subq.l    #8,a1
  2136.     add.l    d6,a1
  2137.     dbf    d0,.talt
  2138.     bra    P61_fxdone
  2139.     endc
  2140.  
  2141.     ifne    P61_fvu
  2142. P61_finevup
  2143.     moveq    #$f,d0
  2144.     and.b    P61_Info(a5),d0
  2145.     add    d0,P61_Volume(a5)
  2146.     moveq    #64,d0
  2147.     cmp    P61_Volume(a5),d0
  2148.     bge    P61_fxdone
  2149.     move    d0,P61_Volume(a5)
  2150.     bra    P61_fxdone
  2151.     endc
  2152.  
  2153.     ifne    P61_fvd
  2154. P61_finevdwn
  2155.     moveq    #$f,d0
  2156.     and.b    P61_Info(a5),d0
  2157.     sub    d0,P61_Volume(a5)
  2158.     bpl    P61_fxdone
  2159.     clr    P61_Volume(a5)
  2160.     bra    P61_fxdone
  2161.     endc
  2162.  
  2163.     ifne    P61_timing
  2164. P61_sete8
  2165.     moveq    #$f,d0
  2166.     and.b    P61_Info(a5),d0
  2167.     move    d0,P61_E8(a3)
  2168.     bra    P61_fxdone
  2169.     endc
  2170.  
  2171.     ifne    P61_rt
  2172. P61_setretrig
  2173.     moveq    #$f,d0
  2174.     and.b    P61_Info(a5),d0
  2175.     move    d0,P61_RetrigCount(a5)
  2176.     bra    P61_fxdone
  2177.     endc
  2178.  
  2179.     ifne    P61_nd
  2180. P61_ndelay
  2181.     moveq    #$7e,d0
  2182.     and.b    (a5),d0
  2183.     beq    P61_skip
  2184.     ifne    P61_vib
  2185.     clr.b    P61_VibPos(a5)
  2186.     endc
  2187.     ifne    P61_tre
  2188.     clr.b    P61_TrePos(a5)
  2189.     endc
  2190.     ifne    P61_ft
  2191.     add    P61_Fine(a5),d0
  2192.     endc
  2193.     move    d0,P61_Note(a5)
  2194.     move    (a2,d0),P61_Period(a5)
  2195.     ifeq    fade
  2196.     move    P61_Volume(a5),8(a4)
  2197.     else
  2198.     move    P61_Volume(a5),P61_Shadow(a5)
  2199.     endc
  2200.     bra    P61_skip
  2201.     endc
  2202.  
  2203.     ifne    P61_pde
  2204. P61_pattdelay
  2205.     moveq    #$f,d0
  2206.     and.b    P61_Info(a5),d0
  2207.     move    d0,P61_pdelay(a3)
  2208.     st    P61_pdflag(a3)
  2209.     bra    P61_fxdone
  2210.     endc
  2211.  
  2212.     ifne    P61_sd
  2213. P61_cspeed
  2214.     moveq    #0,d0
  2215.     move.b    P61_Info(a5),d0
  2216.  
  2217.     ifne    CIA
  2218.     tst    P61_Tempo(a3)
  2219.     beq.b    P61_VBlank
  2220.     cmp.b    #32,d0
  2221.     bhs.b    P61_STempo
  2222.     endc
  2223.  
  2224. P61_VBlank
  2225.     cmp.b    #1,d0
  2226.     beq.b    P61_jkd
  2227.  
  2228.     move.b    d0,P61_speed+1(a3)
  2229.     subq.b    #1,d0
  2230.     move.b    d0,P61_speed2+1(a3)
  2231.     clr    P61_speedis1(a3)
  2232.     bra    P61_fxdone
  2233.  
  2234. P61_jkd    move.b    d0,P61_speed+1(a3)
  2235.     move.b    d0,P61_speed2+1(a3)
  2236.     st    P61_speedis1(a3)
  2237.     bra    P61_fxdone
  2238.  
  2239.  
  2240.     ifne    CIA
  2241. P61_STempo
  2242.     move.l    P61_timer(pc),d1
  2243.     divu    d0,d1
  2244.     move    d1,P61_thi2(a3)
  2245.     sub    #$1f0*2,d1
  2246.     move    d1,P61_thi(a3)
  2247.  
  2248.     ifeq    system
  2249.     move    P61_thi2(a3),d1
  2250.     move.b    d1,$bfd400
  2251.     lsr    #8,d1
  2252.     move.b    d1,$bfd500
  2253.     endc
  2254.  
  2255.     bra    P61_fxdone
  2256.     endc
  2257.     endc
  2258.  
  2259.  
  2260.  
  2261.     ifne    P61_vbvs
  2262. P61_vibochvslide
  2263.     move.b    P61_Info(a5),d0
  2264.     sub.b    d0,P61_Volume+1(a5)
  2265.     bpl.b    P61_test62
  2266.     clr    P61_Volume(a5)
  2267.     ifeq    fade
  2268.     clr    8(a4)
  2269.     else
  2270.     clr    P61_Shadow(a5)
  2271.     endc
  2272.     bra.b    P61_vib2
  2273. P61_test62
  2274.     moveq    #64,d0
  2275.     cmp    P61_Volume(a5),d0
  2276.     bge.b    .ncs2
  2277.     move    d0,P61_Volume(a5)
  2278. .ncs2    ifeq    fade
  2279.     move    P61_Volume(a5),8(a4)
  2280.     else
  2281.     move    P61_Volume(a5),P61_Shadow(a5)
  2282.     endc
  2283.     endc
  2284.  
  2285.     ifne    P61_vib
  2286. P61_vib2
  2287.     move    #$f00,d0
  2288.     move    P61_VibCmd(a5),d1
  2289.     and    d1,d0
  2290.     lsr    #3,d0
  2291.  
  2292.     lsr    #2,d1
  2293.     and    #$1f,d1
  2294.     add    d1,d0
  2295.  
  2296.     move    P61_Period(a5),d1
  2297.     moveq    #0,d2
  2298.     move.b    P61_vibtab(pc,d0),d2
  2299.  
  2300.     tst.b    P61_VibPos(a5)
  2301.     bmi.b    .vibneg
  2302.     add    d2,d1
  2303.     bra.b    P61_vib4
  2304.  
  2305. .vibneg    sub    d2,d1
  2306.  
  2307. P61_vib4
  2308.     move    d1,6(a4)
  2309.     move.b    P61_VibCmd(a5),d0
  2310.     lsr.b    #2,d0
  2311.     and    #$3c,d0
  2312.     add.b    d0,P61_VibPos(a5)
  2313.     bra    P61_contfxdone
  2314.     endc
  2315.  
  2316.     ifne    P61_tre
  2317. P61_tremo
  2318.     move    #$f00,d0
  2319.     move    P61_TreCmd(a5),d1
  2320.     and    d1,d0
  2321.     lsr    #3,d0
  2322.     
  2323.     lsr    #2,d1
  2324.     and    #$1f,d1
  2325.     add    d1,d0
  2326.  
  2327.     move    P61_Volume(a5),d1
  2328.     moveq    #0,d2
  2329.     move.b    P61_vibtab(pc,d0),d2
  2330.  
  2331.     tst.b    P61_TrePos(a5)
  2332.     bmi.b    .treneg
  2333.     add    d2,d1
  2334.     cmp    #64,d1
  2335.     ble.b    P61_tre4
  2336.     moveq    #64,d1
  2337.     bra.b    P61_tre4
  2338.  
  2339. .treneg    sub    d2,d1
  2340.     bpl.b    P61_tre4
  2341.     moveq    #0,d1
  2342. P61_tre4
  2343.     ifeq    fade
  2344.     move    d1,8(a4)
  2345.     else
  2346.     move    d1,P61_Shadow(a5)
  2347.     endc
  2348.  
  2349.     move.b    P61_TreCmd(a5),d0
  2350.     lsr.b    #2,d0
  2351.     and    #$3c,d0
  2352.     add.b    d0,P61_TrePos(a5)
  2353.     bra    P61_contfxdone
  2354.     endc
  2355.  
  2356.     ifne    P61_vib!P61_tre
  2357. P61_vibtab    incbin    vibtab
  2358.     endc
  2359.  
  2360.     ifne    P61_il
  2361. P61_funk
  2362.     moveq    #$f,d0
  2363.     and.b    P61_Info(a5),d0
  2364.     move.b    d0,P61_Funkspd(a5)
  2365.     bra    P61_fxdone
  2366.  
  2367. P61_funk2
  2368.     moveq    #0,d0
  2369.     move.b    P61_Funkspd(a5),d0
  2370.     beq.b    P61_funkend
  2371.     move.b    P61_FunkTable(pc,d0),d0
  2372.     add.b    d0,P61_Funkoff(a5)
  2373.     bpl.b    P61_funkend
  2374.     clr.b    P61_Funkoff(a5)
  2375.  
  2376.     move.l    P61_Sample(a5),a1
  2377.     move.l    P61_RepeatOffset(a1),d1
  2378.     move    P61_RepeatLength(a1),d0
  2379.     add.l    d0,d0
  2380.     add.l    d1,d0
  2381.     move.l    P61_Wave(a5),a0
  2382.     addq.l    #1,a0
  2383.     cmp.l    d0,a0
  2384.     blo.b    P61_funkok
  2385.     move.l    d1,a0
  2386. P61_funkok
  2387.     move.l    a0,P61_Wave(a5)
  2388.     not.b    (a0)
  2389. P61_funkend
  2390.     rts
  2391.  
  2392. P61_FunkTable dc.b 0,5,6,7,8,10,11,13,16,19,22,26,32,43,64,128
  2393.     endc
  2394.  
  2395. P61_jtab
  2396.     dr    P61_fxdone
  2397.     dr    P61_fxdone
  2398.     dr    P61_fxdone
  2399.  
  2400.     ifne    P61_tp
  2401.     dr    P61_settoneport
  2402.     else
  2403.     dr    P61_fxdone
  2404.     endc
  2405.  
  2406.     ifne    P61_vib
  2407.     dr    P61_vibrato
  2408.     else
  2409.     dr    P61_fxdone
  2410.     endc
  2411.  
  2412.     ifne    P61_tpvs
  2413.     dr    P61_toponochange
  2414.     else
  2415.     dr    P61_fxdone
  2416.     endc
  2417.  
  2418.     dr    P61_fxdone
  2419.  
  2420.     ifne    P61_tre
  2421.     dr    P61_settremo
  2422.     else
  2423.     dr    P61_fxdone
  2424.     endc
  2425.  
  2426.     dr    P61_fxdone
  2427.  
  2428.     ifne    P61_sof
  2429.     dr    P61_sampleoffse
  2430.     else
  2431.     dr    P61_fxdone
  2432.     endc
  2433.     dr    P61_fxdone
  2434.  
  2435.     ifne    P61_pj
  2436.     dr    P61_posjmp
  2437.     else
  2438.     dr    P61_fxdone
  2439.     endc
  2440.  
  2441.     ifne    P61_vl
  2442.     dr    P61_volum
  2443.     else
  2444.     dr    P61_fxdone
  2445.     endc
  2446.  
  2447.     ifne    P61_pb
  2448.     dr    P61_pattbreak
  2449.     else
  2450.     dr    P61_fxdone
  2451.     endc
  2452.  
  2453.     ifne    P61_ec
  2454.     dr    P61_ecommands
  2455.     else
  2456.     dr    P61_fxdone
  2457.     endc
  2458.     
  2459.     ifne    P61_sd
  2460.     dr    P61_cspeed
  2461.     else
  2462.     dr    P61_fxdone
  2463.     endc
  2464.  
  2465.  
  2466. P61_dmason
  2467.     ifeq    system
  2468.     tst.b    $bfdd00
  2469.     move    #$2000,$dff09c
  2470.     move.b    #$19,$bfdf00
  2471.     move.l    a0,-(sp)
  2472.     move.l    P61_vektori(pc),a0
  2473.     move.l    P61_intaddr(pc),(a0)
  2474.     move.l    (sp)+,a0
  2475.     move    P61_dma(pc),$dff096
  2476.     nop
  2477.     rte
  2478.  
  2479.     else
  2480.  
  2481.     move    P61_dma(pc),$96(a6)
  2482.     lea    P61_server(pc),a3
  2483.     addq    #1,(a3)
  2484.     move.l    P61_craddr(pc),a0
  2485.     move.b    #$19,(a0)
  2486.     bra    P61_ohi
  2487.     endc
  2488.  
  2489.  
  2490. P61_setrepeat
  2491.     ifeq    system
  2492.     tst.b    $bfdd00
  2493.     movem.l    a0/a1,-(sp)
  2494.     lea    $dff0a0,a1
  2495.     move    #$2000,-4(a1)
  2496.     else
  2497.     lea    $a0(a6),a1
  2498.     endc
  2499.  
  2500.     move.l    P61_Sample+P61_temp0(pc),a0
  2501.     addq.l    #6,a0
  2502.     move.l    (a0)+,(a1)+
  2503.     move    (a0),(a1)
  2504.  
  2505.     ifgt    channels-1
  2506.     move.l    P61_Sample+P61_temp1(pc),a0
  2507.     addq.l    #6,a0
  2508.     move.l    (a0)+,12(a1)
  2509.     move    (a0),16(a1)
  2510.     endc
  2511.     
  2512.     ifgt    channels-2
  2513.     move.l    P61_Sample+P61_temp2(pc),a0
  2514.     addq.l    #6,a0
  2515.     move.l    (a0)+,28(a1)
  2516.     move    (a0),32(a1)
  2517.     endc
  2518.  
  2519.     ifgt    channels-3
  2520.     move.l    P61_Sample+P61_temp3(pc),a0
  2521.     addq.l    #6,a0
  2522.     move.l    (a0)+,44(a1)
  2523.     move    (a0),48(a1)
  2524.     endc
  2525.  
  2526.     ifne    system
  2527.     ifne    CIA
  2528.     lea    P61_server(pc),a3
  2529.     clr    (a3)
  2530.     move.l    P61_craddr+4(pc),a0
  2531.     move.b    P61_tlo(pc),(a0)
  2532.     move.b    P61_thi(pc),$100(a0)
  2533.     endc
  2534.     bra    P61_ohi
  2535.     endc
  2536.  
  2537.     ifeq    system
  2538.     ifne    CIA
  2539.     move.l    P61_vektori(pc),a0
  2540.     move.l    P61_tintti(pc),(a0)
  2541.     endc
  2542.     movem.l    (sp)+,a0/a1
  2543.     nop
  2544.     rte
  2545.     endc
  2546.  
  2547. P61_temp0    dcb.b    Channel_Block_SIZE-2
  2548.         dc    1
  2549.  
  2550. P61_temp1    dcb.b    Channel_Block_SIZE-2
  2551.         dc    2
  2552.  
  2553. P61_temp2    dcb.b    Channel_Block_SIZE-2
  2554.         dc    4
  2555.  
  2556. P61_temp3    dcb.b    Channel_Block_SIZE-2
  2557.         dc    8
  2558.  
  2559. P61_cn        dc    0
  2560. P61_dma        dc    $8200
  2561. P61_rowpos    dc    0
  2562. P61_slen    dc    0
  2563. P61_speed    dc    0
  2564. P61_speed2    dc    0
  2565. P61_speedis1    dc    0
  2566. P61_spos    dc.l    0
  2567.  
  2568.     ifeq    system
  2569. P61_vektori    dc.l    0
  2570. P61_oldlev6    dc.l    0
  2571.     endc
  2572.  
  2573. P61_ofilter    dc    0
  2574. P61_timers    dc.l    0
  2575.  
  2576.     ifne    CIA
  2577. P61_tintti    dc.l    0
  2578. P61_thi        dc.b    0
  2579. P61_tlo        dc.b    0
  2580. P61_thi2    dc.b    0
  2581. P61_tlo2    dc.b    0
  2582. P61_timer    dc.l    0
  2583.     endc
  2584.  
  2585.     ifne    P61_pl
  2586. P61_plcount    dc    0
  2587. P61_plflag    dc    0
  2588. P61_plreset    dc    0
  2589. P61_plrowpos    dc    0
  2590. P61_looppos    dcb.b    12*channels
  2591.     endc
  2592.  
  2593.     ifne    P61_pde
  2594. P61_pdelay    dc    0
  2595. P61_pdflag    dc    0
  2596.     endc
  2597.  
  2598. P61_samples    dcb.b    16*31
  2599. P61_emptysample    dcb.b    16
  2600. P61_positionbase dc.l    0
  2601. P61_possibase    dc.l    0
  2602. P61_patternbase    dc.l    0
  2603. P61_intaddr    dc.l    0
  2604.  
  2605.     ifne    system
  2606. P61_server    dc    0
  2607. P61_miscbase    dc.l    0
  2608. P61_audioopen    dc.b    0
  2609. P61_sigbit    dc.b    -1
  2610. P61_ciares    dc.l    0
  2611. P61_craddr    dc.l    0,0,0
  2612. P61_dat        dc    $f00
  2613. P61_timerinterrupt dc    0,0,0,0,127
  2614. P61_timerdata    dc.l    0,0,0
  2615. P61_timeron    dc    0
  2616. P61_allocport    dc.l    0,0
  2617.         dc.b    4,0
  2618.         dc.l    0
  2619.         dc.b    0,0
  2620.         dc.l    0
  2621. P61_reqlist    dc.l    0,0,0
  2622.         dc.b    5,0
  2623. P61_allocreq    dc.l    0,0
  2624.         dc    127
  2625.         dc.l    0
  2626. P61_portti    dc.l    0
  2627.         dc    68
  2628.         dc.l    0,0,0
  2629.         dc    0
  2630. P61_reqdata    dc.l    0
  2631.         dc.l    1,0,0,0,0,0,0
  2632.         dc    0
  2633. P61_audiodev    dc.b    'audio.device',0
  2634.  
  2635. P61_cianame    dc.b    'ciab.resource',0
  2636. P61_timeropen    dc.b    0
  2637. P61_timerint    dc.b    'P61_TimerInterrupt',0,0
  2638.     endc
  2639. P61_etu
  2640.  
  2641.     endb    a3
  2642.  
  2643.  
  2644. ******** END OF BINARY FILE **************
  2645.  
  2646.     section    chip,data_c
  2647. P61_data    incbin    "ram:P61.alf theme"
  2648. ;P61_smp    incbin    "ram:SMP.fields of green"
  2649.  
  2650.     section    smp,bss_c
  2651. samples    ;ds.b    $10000        ;uncomment if you have packed samples
  2652.                 ;and insert sample buffer length
  2653.